<template>
  <div class="printForm">
    <div class="area-header">
      <span class="area-header-title">{{ $t('申请单') }}</span>
    </div>
    <table class="printTable">
      <tr>
        <td class="tit">{{ $t('申请人') }}</td>
        <td>{{ form.userName }}</td>
        <td class="tit">{{ $t('部门') }}</td>
        <td>{{ form.deptName }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('申请时间') }}</td>
        <td>{{ parseTime(form.applyTime) }}</td>
        <td class="tit">{{ $t('拟离职日期') }}</td>
        <td>{{ parseTime(form.lastTime) }}</td>
      </tr>
      <tr>
        <td class="tit">{{ $t('交接人') }}</td>
        <td><UserSelect v-model="form.handoverUser" :placeholder="$t('交接人')" /></td>
        <td class="tit">{{ $t('交接时间') }}</td>
        <td>
          {{ parseTime(form.handoverDateStart) }} / {{ parseTime(form.handoverDateEnd) }}
        </td>
      </tr>
      <tr>
        <td class="tit">{{ $t('备注') }}</td>
        <td colspan="3">{{ form.remark }}</td>
      </tr>
    </table>

    <!-- 附件列表 -->
    <FileView :list.sync="form.fileList" data-type="hr_quit" :btn-show="!otherBtnHide" />
  </div>
</template>

<script>
import { getHrQuit } from '@/api/oa/hr/hrQuit'
export default {
  data() {
    return {
      otherBtnHide: false,
      // 表单参数
      form: {
        times: [],
        fileList: []
      },
      // 操作按钮默认不展示
      buttonShow: true
    }
  },
  created() {
    this.$bus.$emit('async_done')
  },
  methods: {
    // 初始化数据
    init(data) {
      if (data != null && data.id !== undefined) {
        getHrQuit(data.id).then(response => {
          this.form = response.data
          this.form.times = [this.form.handoverDateStart, this.form.handoverDateEnd]
        })
      }
    }

  }

}
</script>
